﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Project_Vital.Dao;

namespace Project_Vital
{
    public partial class ViewCustomers : Form
    {
        public ViewCustomers()
        {
            InitializeComponent();
            FillGrid();
            CustomerDao customer = new CustomerDao();
            this.dataGridView1.DataSource = customer.GetCustomers();
        }

        private void FillGrid()
        {
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.Dock = DockStyle.Fill;

            DataGridViewTextBoxColumn firstNameColumn = new DataGridViewTextBoxColumn();
            firstNameColumn.DataPropertyName = "_vcus_first_name";
            firstNameColumn.HeaderText = "First Name";

            DataGridViewTextBoxColumn lastNameColumn = new DataGridViewTextBoxColumn();
            lastNameColumn.DataPropertyName = "_vcus_surname";
            lastNameColumn.HeaderText = "Last Name";

            DataGridViewTextBoxColumn contactNameColumn = new DataGridViewTextBoxColumn();
            contactNameColumn.DataPropertyName = "_vcus_contact_name";
            contactNameColumn.HeaderText = "Contact Name";


            DataGridViewTextBoxColumn openTimeColumn = new DataGridViewTextBoxColumn();
            openTimeColumn.DataPropertyName = "_vcus_open_time";
            openTimeColumn.HeaderText = "Open Time";

            DataGridViewTextBoxColumn closeTimeColumn = new DataGridViewTextBoxColumn();
            closeTimeColumn.DataPropertyName = "_vcus_close_time";
            closeTimeColumn.HeaderText = "Close Timje";

            DataGridViewTextBoxColumn phoneColumn = new DataGridViewTextBoxColumn();
            phoneColumn.DataPropertyName = "_vcus_phone";
            phoneColumn.HeaderText = "Phone";


            dataGridView1.Columns.Add(firstNameColumn);
            dataGridView1.Columns.Add(lastNameColumn);
            dataGridView1.Columns.Add(contactNameColumn);

            dataGridView1.Columns.Add(openTimeColumn);
            dataGridView1.Columns.Add(closeTimeColumn);
            dataGridView1.Columns.Add(phoneColumn);
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
        }
    }
}
